package wordroid.activitys;

import java.util.ArrayList;

import wordroid.database.DataAccess;
import wordroid.model.Word;
import android.app.AlertDialog;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class Attention extends ListActivity
{
  public static final int MENU_ADD = 1;
  private ArrayList<Word> list;

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setTitle("生词本");
    setContentView(2130903040);
    setAdapter();
  }

  public boolean onCreateOptionsMenu(Menu paramMenu)
  {
    paramMenu.add(0, 1, 0, "添加新单词");
    return true;
  }

  protected void onListItemClick(ListView paramListView, View paramView, int paramInt, long paramLong)
  {
    super.onListItemClick(paramListView, paramView, paramInt, paramLong);
    AlertDialog.Builder localBuilder = new AlertDialog.Builder(this).setIcon(2130837509).setTitle("操作");
    String[] arrayOfString = new String[2];
    arrayOfString[0] = "编辑该单词";
    arrayOfString[1] = "从生词本中删除";
    localBuilder.setItems(arrayOfString, /*new 1(this, paramInt)*/null).setNegativeButton("取消", /*new 2(this)*/null).create().show();
  }

  public boolean onOptionsItemSelected(MenuItem paramMenuItem)
  {
    switch (paramMenuItem.getItemId())
    {
    default:
    case 1:
    }
    while (true)
    {
     
      Intent localIntent = new Intent();
      Bundle localBundle = new Bundle();
      localBundle.putString("action", "add");
      localIntent.putExtras(localBundle);
      localIntent.setClass(this, EditWord.class);
      startActivity(localIntent);
      return super.onOptionsItemSelected(paramMenuItem);
    }
  }

  protected void onResume()
  {
    setAdapter();
    super.onResume();
  }

  protected void setAdapter()
  {
    this.list = new DataAccess(this).QueryAttention(null, null);
    ArrayList localArrayList = new ArrayList();
    for (int i = 0; ; ++i)
    {
      if (i >= this.list.size())
      {
        setListAdapter(new ArrayAdapter(this, 2130903042, localArrayList));
        return;
      }
      localArrayList.add((i + 1) + "." + ((Word)this.list.get(i)).getSpelling() + "\n" + ((Word)this.list.get(i)).getMeanning());
    }
  }
}

/* Location:           E:\Desktop\Android\英语词汇记忆\classes_dex2jar.jar
 * Qualified Name:     wordroid.activitys.Attention
 * JD-Core Version:    0.5.3
 */